<template>
  <view class="content">
    <view class="login_btn">
      <button class="submit_btn" type="primary" @click="tel()">请扫描铭牌上的二维码</button>
    </view>
    <view class="atext" @click="handleClick">
      <text>点击此链接，输入条码</text>
    </view>
    <view>
      <pop
        ref="pop"
        direction="center"
        :is_close="true"
        :is_mask="true"
        :width="80"
        height="fit-content"
        :maskFun="true"
        @watchOpen="watchOpen"
        @watchClose="watchClose"
      >
        <view class="center">
          <view>设计位移:xxx</view>
          <view>设计温度:xxx</view>
          <view>设计压力:xxx</view>
          <view>波纹管壁厚:xxx</view>
          <view>介质:xxx</view>
          <view>开始点检任务?</view>
          <view>
            <button type="primary" @click="handleComplete">确定</button>
          </view>
        </view>
      </pop>
    </view>
  </view>
</template>

<script>
import pop from '@/components/ming-pop/ming-pop.vue'
export default {
  components: { pop },
  data() {
    return {}
  },
  onLoad() {
    //  this.tel()
  },
  methods: {
    tel() {
      // console.log("3`13`13")
      //         uni.scanCode({
      //  	onlyFromCamera: true,//只允许拍照，不允许本地相册
      // 	scanType:["qrCode"],//扫码类型 以为 二位 xxx
      //     success:  (res)=> {
      //         console.log('条码内容：' + res);
      //     }
      // });
      
      uni.scanCode({
        success: function(res) {
          // console.log(JSON.stringify(res))
          this.$refs.pop.show()
        }
      })
    },
    watchOpen() {},
    watchClose() {},
    handleComplete() {
      this.$refs.pop.close()
      uni.navigateTo({
        url: '/pages/detail/detail'
      })
      //   this.$router.push({
      //     path: '/pages/detail/detail'
      //   })
      //   uni.showModal({
      //     title: '提示',
      //     content: '开始点检任务？',
      //     success: res => {
      //       if (res.confirm) {
      //         this.$refs.pop.close()
      //         this.$router.push({
      //             path:"/pages/detail/detail"
      //         })
      //       } else if (res.cancel) {
      //         this.$refs.pop.close()
      //       }
      //     }
      //   })
    },
    handleClick() {}
  }
}
</script>

<style lang="scss" scope>
.login_btn {
  width: 75%;
  margin-top: 40rpx;
}
.login_btn button {
  color: #f8f5f5;
  background: #0065fd;
  //   border-radius: 50rpx;
  font-size: 22rpx;
  padding: 10rpx 0;
  font-weight: bolder;
}
.center {
  // margin-left: 100rpx;
  text-align: center;
}
.center {
  uni-button {
    margin-top: 20rpx;
    font-size: 24rpx;
    width: 200rpx;
  }
}
.atext {
  font-size: 24rpx;
  margin-top: 50rpx;
}
text {
  color: rgb(117, 109, 106);
  text-decoration: underline;
}
text:hover {
  color: #0a8de7;
}
</style>